Repository navigation
FileWatchService: directory baselines off the UI thread, scans stop early (#1303) - #1306
Merged
Merged
Conversation
…arly (#1303) - watchDirectory() no longer lists the directory: the next scan (watcher thread, or the next poll()) adopts its listing as the subscription's baseline, only for subscriptions created before that scan started (scan generations); also when joining a shared watch. - Stopping the watcher thread ends a scan in progress: each thread has its own abort flag, checked between watched paths and between directory entries, also while a directory's entries are collected; a partial listing is neither compared nor adopted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1303.
Changes
watchDirectory()no longer reads the listing on the UI thread. The next scan (the watcher thread, or the nextpoll()in manual mode) adopts its listing as the subscription's baseline and reports nothing for it; changes made before that scan aren't reported (documented). A subscriber joining a shared directory watch gets its baseline the same way.WatcherThreadhas its own abort flag (found in the review: no service-wide flag to set and reset), checked between watched paths and between directory entries, also while a directory's entries are collected. A partial listing is neither compared nor adopted.Testing
scanDirectory's walk) reports and adopts nothing; a subscription created during a scan is adopted by the next one;readListingstops when told to; switching to manual mode stops the thread and polls still work. Mutation checks: the baseline adoption, the generation check, the walk's abort check andscanDirectory's early return each fail the tests when removed.dub testwith LDC 1.36 (37 modules), DMD 2.100.2 (37),-c console(34), dip1000, Windows (38); D-Scanner.🤖 Generated with Claude Code